import { ElMessage } from "element-plus";

const baseUrl = "http://47.113.185.182:7374";

//获取图片尺寸
export const getImageSize = (imageUrl, imgName = "") => {
  return new Promise((resolve, reject) => {
    let img = new Image();
    img.src = baseUrl + imageUrl;
    img.onload = () => {
      resolve({ width: img.width, height: img.height });
    };
    img.onerror = function () {
      ElMessage.warning(imgName + "加载失败，请检查网络或图片地址是否正确！");
      reject(null);
    };
  });
};
